package com.example.examsystem.model;

import jakarta.persistence.*;
import lombok.Data;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;

import java.time.LocalDateTime;

/**
 * 试题导入记录实体类
 * 映射数据库中的question_import表，记录试题导入的相关信息
 */
@Data
@Entity
@Table(name = "question_import")
public class QuestionImport extends BaseEntity {

    /**
     * 导入记录ID，主键，自增
     */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 文件名
     */
    @Column(name = "file_name", length = 255)
    private String fileName;

    /**
     * 文件大小（字节）
     */
    @Column(name = "file_size")
    private Long fileSize;

    /**
     * 总记录数
     */
    @Column(name = "total_count")
    private Integer totalCount;

    /**
     * 成功记录数
     */
    @Column(name = "success_count")
    private Integer successCount;

    /**
     * 失败记录数
     */
    @Column(name = "fail_count")
    private Integer failCount;

    /**
     * 状态 (PROCESSING, SUCCESS, FAILED)
     */
    @Column(name = "status", length = 20)
    private String status;

    /**
     * 错误信息
     */
    @Column(name = "error_message", length = 1000)
    private String errorMessage;

    /**
     * 错误文件路径
     */
    @Column(name = "error_file_path", length = 500)
    private String errorFilePath;

    /**
     * 导入类型
     */
    @Column(name = "import_type", length = 50)
    private String importType;

    /**
     * 创建时间
     */
    @CreatedDate
    @Column(name = "created_at", nullable = false, updatable = false)
    private LocalDateTime createdAt;

    @LastModifiedDate
    @Column(name = "updated_at", nullable = false)
    private LocalDateTime updatedAt;
}